/*
 * Copyright 2010-2011 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package kr.co.cooknote.config;

import javax.sql.DataSource;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.jdbc.datasource.DriverManagerDataSource;
//import org.h2.jdbcx.JdbcConnectionPool;
//import com.springsource.greenhouse.database.DatabaseUpgrader;
//import org.springframework.jdbc.versioned.DatabaseChangeSet;
//import org.springframework.jdbc.versioned.SqlDatabaseChange;
//import org.springframework.jdbc.versioned.DatabaseChangeSet;
//import org.springframework.jdbc.versioned.SqlDatabaseChange;

//import com.springsource.greenhouse.database.DatabaseUpgrader;

@Configuration
public class DataSourceConfig {

	@Value("${cooknote.mysql.url}")
	private String mySqlUrl;
	@Value("${cooknote.mysql.user}")
	private String mySqlUser;
	@Value("${cooknote.mysql.password}")
	private String mySqlPassword;
	@Value("${cooknote.mysql.driver}")
	private String mySqlDriver;

	@Bean
	public DataSource devDataSource() {

		DriverManagerDataSource datasource = new DriverManagerDataSource(mySqlUrl, mySqlUser, mySqlPassword);
		datasource.setDriverClassName(mySqlDriver);
		return datasource;
	}
}
